﻿<MDataTable Headers="_headers"
            Items="_desserts"
            ItemsPerPage="5"
            Class="elevation-1">
</MDataTable>

@code {

    private record Dessert(string Name, int Calories, double Fat, int Carbs, double Protein, string Iron);

    private List<DataTableHeader<Dessert>> _headers =
    [
        new("Dessert (100g serving)", nameof(Dessert.Name))
        {
            Align = DataTableHeaderAlign.Start,
            Sortable = false,
        },
        new("Calories", nameof(Dessert.Calories)),
        new("Fat (g)", nameof(Dessert.Fat)),
        new("Carbs (g)", nameof(Dessert.Carbs)),
        new("Protein (g)", nameof(Dessert.Protein)),
        new("Iron (%)", nameof(Dessert.Iron))
    ];

    private List<Dessert> _desserts =
    [
        new("Frozen Yogurt", 159, 6.0, 24, 4.0, "1%"),
        new("Ice cream sandwich", 237, 9.0, 37, 4.3, "1%"),
        new("Eclair", 262, 16.0, 23, 6.0, "7%"),
        new("Cupcake", 305, 3.7, 67, 4.3, "8%"),
        new("Gingerbread", 356, 16.0, 49, 3.9, "16%"),
        new("Jelly bean", 375, 0.0, 94, 0.0, "0%"),
        new("Lollipop", 392, 0.2, 98, 0, "2%"),
        new("Honeycomb", 408, 3.2, 87, 6.5, "45%"),
        new("Donut", 452, 25.0, 51, 4.9, "22%"),
        new("KitKat", 518, 26.0, 65, 7, "6%")
    ];

}